<style>
.bdr, .col {
    border-left: 1px solid #fff;
    border-right: 1px solid #ccc;
}
.bdrBottom {
    border-bottom: 1px solid #ccc;
}
.total {
    font-weight: bold;
    border-top: 1px solid #ccc;
}
.col {
    width: 70px;
    padding: 3px 5px;
}
div.saving {
    color: #FF8000;
    font-style: italic;
}
thead td.col, tfoot td.col {
    background-color: #EAEAEA;
}
#stocks tbody tr:hover {
    background-color: #D9EBF5;
}
</style>

<div class="wrap" style="padding-top:8px;">
  <div id="icon-index" class="icon32"></div>
  <div class="wrap fLeft"><h2 style="padding-top:0;"><?php e($pageTitle) ?></h2></div>
  <div id="message"></div>
  <div id="progress" class="fRight" style="visibility:hidden;"></div>
  <div class="clear"></div>

  <div id="grid-wrap">
    <form id="form-pos" method="post" action="<?php e($this->base); ?>/admin/<?php e($this->params['controller']); ?>/update" onsubmit="return save();">

    <table cellpadding="6" cellspacing="0" border="0" align="left" style="margin-top:10px; border:1px solid #ccc;">
      <thead>
        <tr>
          <td colspan="5" class="col bdrBottom" style="height:30px;">
            <b>POS<?php /*e($stockist);*/ ?></b>
          </td>
        </tr>
      </thead>
<?php if (count($stokist) > 0) { ?>
      <tr>
        <td>Stockist:</td>
        <td>
          <select id="stockist_id" name="stockist_id" class="select">
<?php     foreach ($stokist as $id=>$name) { ?>
            <option value="<?php e($id); ?>"><?php e($name); ?></option>
<?php     } ?>
          </select>
        </td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
<?php } ?>
      <tr>
        <td>User Id:</td>
        <td>
          <input type="text" id="member-code" name="member_code" class="input req" />
        </td>
        <td width="30">&nbsp;</td>
        <td>Date:</td>
        <td style="padding-right:8px;">
          <input type="hidden" id="date" name="date" />
          <input type="text" id="show-date" value="select.." readonly="readonly" class="date req" />
          <input type="text" id="time" name="time" value="<?php echo date('g:i A'); ?>" class="time req" style="width:48px;" />
        </td>
      </tr>
      <tr>
        <td>Payment Type:</td>
        <td>
          <select name="payment_type" class="select req">
<?php foreach ($paymentType as $key=>$value) { ?>
            <option value="<?php e($key); ?>"><?php e($value); ?></option>
<?php } ?>
          </select>
        </td>
        <td width="30">&nbsp;</td>
        <td>Delivery Method:</td>
        <td>
          <select name="delivery_method" class="select req">
<?php foreach ($deliverMethod as $key=>$value) { ?>
            <option value="<?php e($key); ?>"><?php e($value); ?></option>
<?php } ?>
          </select>
        </td>
      </tr>
<?php if (isset($ignore)) {?>
      <tr>
        <td>Payment Status:</td>
        <td>
          <select name="payment_status" class="select req">
<?php foreach ($paymentStatus as $key=>$value) { ?>
            <option value="<?php e($key); ?>"><?php e($value); ?></option>
<?php } ?>
          </select>
        </td>
        <td width="30">&nbsp;</td>
        <td>Order Status:</td>
        <td>
          <select name="order_status" class="select req">
<?php foreach ($orderStatus as $key=>$value) { ?>
            <option value="<?php e($key); ?>"><?php e($value); ?></option>
<?php } ?>
          </select>
        </td>
      </tr>
<?php } ?>
      <tr>
        <td valign="top" style="padding-top:8px;">Remark:</td>
        <td colspan="4" style="padding-right:8px;"><textarea name="remark" class="input" style="width:448px;"></textarea></td>
      </tr>
      <tr>
        <td colspan="5" align="center">
          <input type="submit" id="submit" value="Save" />
          <input type="reset" value="Reset" />
        </td>
      </tr>
    </table>
    <table cellpadding="6" cellspacing="0" border="0" align="right" style="margin-top:10px;">
      <tr>
        <td>
          <table cellpadding="0" cellspacing="0" border="0" style="width:240px;">
            <tr>
              <td style="font-size:16px;"><?php __('Sub Total:'); ?></td>
            </tr>
            <tr>
              <td id="sub-total" align="right" style="font-size:50px; border-bottom:1px dotted;">0.00</td>
            </tr>
            <tr>
              <td align="right" style="padding-top:3px;">(<span id="sales-bv">0</span> BV)</td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td>
          <table id="coupon-tbl" cellpadding="2" cellspacing="0" border="0" style="margin-top:35px; width:150px; display:none;">
            <tr>
              <td><?php __('Coupon Value'); ?></td>
              <td id="deduct-coupon" align="right">0.00</td>
            </tr>
            <tr>
              <td><?php __('Total Purchase'); ?></td>
              <td id="sub-total2" align="right">-0.00</td>
            </tr>
            <tr>
              <td><?php __('Coupon Balance'); ?></td>
              <td id="new-coupon-balance" align="right" style="border-top:1px solid; border-bottom:1px solid;">0.00</td>
            </tr>
          </table>
        </td>
      </tr>
    </table>

<div class="clear"></div>

    <table cellpadding="5" cellspacing="0" border="0" align="center" style="margin-top:15px; border:1px solid #ccc;">
      <thead>
        <tr>
          <td height="28" class="col bdrBottom center" style="width:226px;"><?php __('Coupon No'); ?></td>
          <td class="col bdrBottom center" style="width:90px;"><?php __('Total Value'); ?></td>
          <td class="col bdrBottom center" style="width:90px;"><?php __('Balance'); ?></td>
          <td class="col bdrBottom center" style="width:165px;"><?php __('Generated Date'); ?></td>
          <td class="col bdrBottom center" style="width:165px;"><?php __('Last Using Date'); ?></td>
          <td class="col bdrBottom center" style="width:90px;"><?php __('Action'); ?></td>
        </tr>
      </thead>
      <tbody id="coupon-body">
        <tr>
          <td class="col center">
            <div id="coupon-list" style="display:inline;"></div>
            <input type="button" id="check-coupon" value="<?php e('Check'); ?>" onclick="getCoupons()" />
          </td>
          <td class="col right"><div id="coupon-total" class="coupon">&nbsp;</div></td>
          <td class="col right"><div id="coupon-balance" class="coupon">&nbsp;</div></td>
          <td class="col center"><div id="coupon-created" class="coupon">&nbsp;</div></td>
          <td class="col center"><div id="coupon-lastUse" class="coupon">&nbsp;</div></td>
          <td class="col center">
            <div id="coupon-action" style="display:none;">
              <label>
                <input type="checkbox" id="useCoupon" name="useCoupon" value="Y" class="fLeft" onclick="toggleCoupon();" />
                <span id="buy-coupon" class="fLeft" style="padding-top:2px;"><?php __('Buy Coupon'); ?></span>
                <span id="use-coupon" class="fLeft" style="padding-top:2px;"><?php __('Use Coupon'); ?></span>
              </label>
            </div>
          </td>
        </tr>
      </tbody>
     </table>

    <table id="stocks" cellpadding="5" cellspacing="0" border="0" style="margin-top:15px; border:1px solid #ccc;">
      <thead>
        <tr>
          <td height="28" class="col bdrBottom center" style="width:80px;"><?php __('Product Code'); ?></td>
          <td class="col bdrBottom" style="width:350px;"><?php __('Product Description'); ?></td>
          <td class="col bdrBottom center"><?php __('BV'); ?></td>
          <td class="col bdrBottom center" style="width:92px;"><?php __('Unit Price(USD)'); ?></td>
          <td class="col bdrBottom center" style="width:165px;"><?php __('Price Purchased by Member'); ?></td>
          <td class="col bdrBottom center" style="width:60px;"><?php __('Quality'); ?></td>
        </tr>
      </thead>
      <tbody id="product-list">
<?php foreach ($data as $i=>$stock) {
        $id    = $stock['Product']['id'];
        $style = ($i%2==0)?'':' style="background-color: #E3E3E3;"'; ?>
        <tr>
          <td valign="top"<?php e($style); ?> class="col center"><div><?php e($stock['Product']['code']); ?></div></td>
          <td valign="top" class="col">
            <b><div><?php e($stock['Product']['name']); ?></div></b>
            <div><?php e(nl2br($stock['Product']['description'])); ?></div>
          </td>
          <td valign="top" class="col right"><div id="bvp_<?php e($id); ?>"><?php e($stock['Product']['bv']); ?></div></td>
          <td valign="top" class="col right"><div id="p1p_<?php e($id); ?>"><?php e($stock['Product']['price']); ?></div></td>
          <td valign="top" class="col right"><div id="p2p_<?php e($id); ?>"><?php e(number_format($stock['Product']['price'] * $memberRate, 2)); ?></div></td>
          <td valign="top" class="col center">
            <input type="text" id="p_<?php e($id); ?>" name="p_<?php e($id); ?>" value="" class="qty" autocomplete="off" style="width:50px; text-align:right;" />
          </td>
        </tr>
<?php } ?>
      </tbody>
      <tfoot>
        <tr>
          <td height="25" colspan="2" class="total col right">Total:</td>
          <td class="total bdr right"><span id="total-bv">0</span></td>
          <td class="total bdr right"><span id="total-price" style="color:red;">0.00</span></td>
          <td class="total bdr right"><span id="total-member-price" style="color:red;">0.00</span></td>
          <td class="total bdr right"><span id="total-qty">0</span></td>
        </tr>
      </tfoot>
    </table>
    </form>
  </div>
</div>
<script>
var _webroot = '<?php e($this->base); ?>';
<?php $this->addScript('Ext.onReady(function() { init(); });'); ?>
</script>